From 876586a44d90919b86c2a2a928ffd166a15d050c Mon Sep 17 00:00:00 2001 From: Brian Koropoff Date: Sun, 20 Jul 2014 15:11:41 -0700 Subject: [PATCH] Fix failure on second run of 'cargo test' Generate the right target filename for rlibs built in test mode so that they are correctly moved back out of the old-root directory. --- src/cargo/ops/cargo_rustc/context.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/src/cargo/ops/cargo_rustc/context.rs b/src/cargo/ops/cargo_rustc/context.rs index 341be4c5a..cdaa1fcd1 100644 --- a/src/cargo/ops/cargo_rustc/context.rs +++ b/src/cargo/ops/cargo_rustc/context.rs @@ -180,7 +180,11 @@ impl<'a, 'b> Context<'a, 'b> { ret.push(format!("{}{}{}", prefix, stem, suffix)); } if target.is_rlib() { - ret.push(format!("lib{}.rlib", stem)); + if target.get_profile().is_test() { + ret.push(format!("{}{}", stem, self.target_exe)); + } else { + ret.push(format!("lib{}.rlib", stem)); + } } if target.is_bin() { ret.push(format!("{}{}", stem, self.target_exe)); -- 2.30.2